﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.Linq;
using System.Linq;
using BusinessLogicLayer;
namespace ExpanseExample
{
    public enum UIMODE
    {
        NEW,
        EDIT,
        VIEW
    }
    public partial class EditExpanse : System.Web.UI.Page
    {
        //private Expanse EditingExpanse
        //{
        //    get
        //    {
        //        return Session["EditingExpanse"] as Expanse;
        //    }
        //    set
        //    {
        //        Session["EditingExpanse"] = value;
        //    }
        //}
        //public UIMODE UIMode
        //{
        //    get
        //    {
        //        if (ViewState["UIMODE"] == null)
        //            ViewState["UIMODE"] = new UIMODE();
        //        return (UIMODE) ViewState["UIMODE"] ;
        //    }
        //    set
        //    {
        //        ViewState["UIMODE"] = value;
        //    }
        //}

        //private int EID
        //{
        //    get
        //    {
        //        if (ViewState["EID"] == null)
        //            ViewState["EID"] = -1;
        //        return (int) ViewState["EID"];
        //    }
        //    set
        //    {
        //        ViewState["EID"] = value;
        //    }
        //}

        protected void Page_Load(object sender, EventArgs e)
        {
            //Response.Cache.SetCacheability(HttpCacheability.NoCache);
            
            if (!IsPostBack)
            {
                DropDownList1.DataSource = new ItemFacade().FindAllCategory();
                DropDownList1.DataTextField = "CategoryName";
                DropDownList1.DataValueField = "CategoryID";
                DropDownList1.DataBind();
                MultiViewExpanse.ActiveViewIndex = 0;
            }
        }

        private void LoadExpanse()
        {
           
        }

        protected void lnkAddAnother_Click(object sender, EventArgs e)
        {
        }

        protected void btnOkay_Click(object sender, EventArgs e)
        {
            try
            {

                foreach (GridViewRow row in GridView1.Rows)
                {
                    CheckBox chk = (CheckBox)row.Cells[0].FindControl("CheckBox1");
                    Label lbl = (Label)row.Cells[0].FindControl("Label1");
                    Label lb2 = (Label)row.FindControl("Label2");
                    if (chk.Checked)
                    {
                        System.Collections.ArrayList arrl = (System.Collections.ArrayList)Session["selected"];
                        arrl.Add(lbl.Text);
                        Session["selected"] = arrl;
                        System.Collections.ArrayList arr2 = (System.Collections.ArrayList)Session["SelectedItems"];
                        arr2.Add(lb2.Text);
                        Session["selected"] = arr2;
                    }
                }
               
            }
            catch
            {
               
            }
        }

        private void UpdateExpanse()
        {
           
      
        }

        private void AddExpanse()
        {
            
        }
    }
}
